//
//@File    :	15.10_exc_mean.h
//@Time    :	2022/03/10 11:57:51
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	exception classes for hmean(),gmean()
//

#include <iostream>
//将一个bad_mean对象初始化为船体给函数hmean()的值,
//而方法mesg()可用于报告问题(包括船体给hmean()的值)
class bad_hmean
{
private:
    double v1;
    double v2;
public:
    bad_hmean(double a=0,double b=0):v1(a),v2(b){}
    void mesg();
};

inline void bad_hmean::mesg(){
    std::cout<<"hmean("<<v1<<", "<<v2<<"): "
            <<"invalid arguments:a=-b\n";//invalid arguments无效参数
}
class bad_gmean
{
private:
public:
    double v1;
    double v2;
    bad_gmean(double a=0,double b=0):v1(a),v2(b) {}
    const char * mesg();
};
inline const char * bad_gmean::mesg(){
    return "gmean() arguments should be>=0\n";
}